-
-
Notifications
You must be signed in to change notification settings - Fork 194
Clojure client #467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@jwr Hi Jan! There is support for a Java WebSocket client - does that maybe help in your case? If not, could you please explain in a little more detail what you're trying to do and what you might need from Sente? |
It seems this is exactly what I was looking for. I took another look at the source code to check why I didn't realize that a Clojure client is there. There were two reasons for this:
In other words, I should have looked closer! |
No worries, it's easy to miss and not explicitly documented anywhere IIRC. Happy to hear that this addresses your case! Feel free to ping if you run into any issues. |
So far I noticed that
|
Good catch, these should be available to Clojure too. Have just pushed https://clojars.org/com.taoensso/sente/versions/1.21.0-alpha3 with the change 👍 |
Here are some more little things that threw me off: The
Similarly, this alias assumes that ClojureScript is always a client:
And finally, a bigger issue: I couldn't find a good way to conditionally disable CSRF protection. To provide some context, I have a server that handles requests from both ClojureScript clients, which do need CSRF protection, and from Clojure clients that use a different authentication method, where CSRF is not required. The current approach with I am not sure what the right solution here is. I think I would like to provide a I worked around this with a kludge by copying the automatically generated CSRF token from the request into params, where Sente normally expects it. |
Hi Jan!
Thanks! I've never tried Sente with a Clojure client myself, and I'm not sure if anyone's actively using it that way - so it's definitely possible you'll run into some small issues.
These are examples of aliases for backwards compatibility. Sente did originally assume that client <=> Cljs. Once that assumption was loosened, more specific names functions were added (like But the old behaviour was retained under these aliases to support pre-existing users.
Would it help if the |
I only reported those because they are confusing (and arguably incorrect) if Sente is used in client-mode from Clojure, in case you wanted to officially support this kind of usage.
Yes, I think this would solve the problem in an elegant way! |
Have just expanded the docstrings to hopefully make these less confusing.
Done 👍 Pushed to https://clojars.org/com.taoensso/sente/versions/1.21.0-alpha4. |
I can confirm that this works very well and lets me skip the CSRF check when needed. Thank you! 🙏 |
Great, thanks for the quick confirmation 👍 |
I am in a situation where a Clojure sente client would be a very good fit. I took a quick look at Sente code and (unless I'm misunderstanding things) it seems this doesn't currently exist: there is an assumption that the client will be in ClojureScript.
Is this assumption deeply baked in?
This is not a "feature request" yet: I am trying to compare various approaches and learn what is feasible.
The text was updated successfully, but these errors were encountered: